package com.google.code.b0rx0r.program;

public class RelativeSnapPoint extends SnapPoint {
	
	private float factor;

	public RelativeSnapPoint(Sequencable sample, float factor) {
		this(sample, factor, null);
	}
	
	public RelativeSnapPoint(Sequencable sample, int offset) {
		this(sample, (float)offset/(float)sample.getLength(), null);
	}

	public RelativeSnapPoint(Sequencable sample, float factor, String name) {
		super(sample, name);
		this.factor = factor;
	}

	@Override
	public int getOffset() {
		return (int)(sample.getLength() * factor);
	}

	@Override
	public void setOffset(int offset) {
		factor = offset/sample.getLength();
	}
	
	

}
